home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9227 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: argc/argv & switches
  5. Date: 07 Mar 1996 15:09:09 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Mar7080909@qcd.lanl.gov>
  8. References: <4h2j8j$9gn@milo.freenet.vancouver.bc.ca> <danpop.825593142@rscernix>
  9.     <313E0094.167EB0E7@fore.com> <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: c2a192@ugrad.cs.ubc.ca's message of 6 Mar 1996 14:54:16 -0800
  14.  
  15. In article <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
  16. c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
  17.  
  18. <snip>
  19. KK: >    The parameters argc and argv and the strings pointed
  20. KK: >    to by the argv array shall be modifiable by the program....
  21. KK: 
  22. KK: But argv[0] is not the argv parameter, but the first pointer pointed at by
  23. KK: argv. That the strings are modifiable doesn't necessarily imply that the
  24. KK: array of pointers through which these strings are accessed is itself
  25. KK: modifiable.
  26. KK: 
  27. KK: However, if it were the case that these pointers are not
  28. modifiable, would not 
  29. KK: the declaration of main() be required to be written as:
  30. KK: 
  31. KK: int main(int argc, char * const *argv)
  32. KK: 
  33. KK:     or
  34. KK: 
  35. KK: int main(int argc, char * const argv[])
  36. KK: 
  37. KK: That is, ``argv is a pointer to a vector of constant pointers to modifiable
  38. KK: chars''.
  39.  
  40. No. No such `requirement' ensues. Compare that string literals have
  41. a type char[], not const char[], and yet are not modifiable. Some
  42. compromise because of history is unavoidable, thought they are
  43. unfortunate. 
  44.  
  45. Cheers
  46. Tanmoy
  47. --
  48. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  49. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  50. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  51. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  52. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  53. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  54.